package com.showcai.core.util;

import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Baggio on 2018-1-25.
 */
public class UrlUtil {
    public static String geturl(HttpServletRequest request) {

        if (request == null) {
            return "";
        }

        String url = "";
        url = request.getRequestURL().toString();
        System.out.println("url:============>>" + url);
        // url = "http://" + request.getLocalName() + url +
        // request.getServletPath();

        java.util.Enumeration names = request.getParameterNames();
        int i = 0;
        String requestPageUrl = "";
        if (!StringUtils.isEmpty(request.getQueryString())) {
            url = url + "?" + request.getQueryString();
        }
        return url;
    }
}
